<template>
  <div class="create-component-list">
    <div v-for="(item, index) in list" :key="index" class="component-item" @click.stop="onItemClick(item)">
      <p-text v-bind="item" />
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { PText } from "@/components";
export default defineComponent({
  name: "ComponentsList",
  components: {
    PText,
  },
  props: {
    list: {
      type: Array,
      required: true,
    }
  },
  emits: ["onItemClick"],
  setup(props, {emit}) {
    const onItemClick = (item: any) => {
      emit("onItemClick", item);
    };
    return {onItemClick};
  },
});
</script>
<style lang="less" scoped></style>
